package org.thirdeyetvg.ncanreader.activity.accessible;

import java.io.IOException;

import org.thirdeyetvg.ncanreader.R;
import org.thirdeyetvg.ncanreader.helper.TextReader;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.widget.TextView;

public class TextAccessibileReaderActivity extends Activity {

	private static final String TAG = TextAccessibileReaderActivity.class
			.getName();

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_text_accessibile_reader);
		Bundle extras = getIntent().getExtras();
		String fileName = extras.getString("fileName");
		TextReader reader = new TextReader();
		String fileContent = null;
		try {
			fileContent = reader.readFile(fileName);
		} catch (IOException e) {
			Log.e(TAG, "Exception in onCreate:" + e.toString());
		}

		TextView txtView = (TextView) findViewById(R.id.tv_text_reader);
		txtView.setText(fileContent);

	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater()
				.inflate(R.menu.activity_text_accessibile_reader, menu);
		return true;
	}

}
